<?php
// Check to see that the values are numbers

// Lower and upper bounds, lower denoted by underscore
$params = array($_POST['HBDONOR_'], $_POST['HBDONOR'], 
				$_POST['HBACCEPTOR_'], $_POST['HBACCEPTOR'],
				$_POST['MW_'], $_POST['MW'], 
				$_POST['LOGP_'], $_POST['LOGP'], 
				$_POST['RBONDS_'], $_POST['RBONDS']);

for ($i=0; $i < count($params); $i++) {
	if ( !(is_numeric($params[$i]) )) { $params[$i] = ''; }
}

?>

<table width="100%">
	<tr><th align="center"><u>Aux. Parameters</u></th></tr>
	<tr><td>
		<br/>
		<div>
			<label>H Donors:</label>
			<input type='text' name='HBDONOR_' size='2' value=<?php echo "'".$params[0]."'"; ?> /> to
			<input type='text' name='HBDONOR' size='2' value=<?php echo "'".$params[1]."'"; ?> />
		</div>
		<div>
			<label>H Accept.:</label>
			<input type='text' name='HBACCEPTOR_' size='2' value=<?php echo "'".$params[2]."'"; ?> /> to
			<input type='text' name='HBACCEPTOR' size='2' value=<?php echo "'".$params[3]."'"; ?> />
		</div>
		<div>
			<label>Mol. Wt.:</label>
			<input type='text' name='MW_' size='2' value=<?php echo "'".$params[4]."'"; ?> /> to
			<input type='text' name='MW' size='2' value=<?php echo "'".$params[5]."'"; ?> />
		</div>
		<div>
			<label>Log(P):</label>
			<input type='text' name='LOGP_' size='2' value=<?php echo "'".$params[6]."'"; ?> /> to
			<input type='text' name='LOGP' size='2' value=<?php echo "'".$params[7]."'"; ?> />
		</div>
		<div>
			<label>Rot. Bonds:</label>
			<input type='text' name='RBONDS_' size='2' value=<?php echo "'".$params[8]."'"; ?> /> to
			<input type='text' name='RBONDS' size='2' value=<?php echo "'".$params[9]."'"; ?> />
		</div>
		
		<br/><hr/><br/>
		
		<?php 
			// Make sure that both start and end cannot be checked
			if ((isset($_POST['BEGINS'])) && (isset($_POST['ENDS']))) { 
				unset($_POST['BEGINS']); 
				unset($_POST['ENDS']); 
			} 
		?>
		
		<div>
			<label>SMILES:</label>
			<input type='checkbox' name='SMILES' <?php if (isset($_POST['SMILES'])) { echo 'checked'; } ?> />
		</div>
		<div>
			<label>Starts with:</label>
			<input type='checkbox' name='BEGINS' <?php if (isset($_POST['BEGINS'])) { echo 'checked'; } ?> />
		</div>
		<div>
			<label>Ends With:</label>
			<input type='checkbox' name='ENDS' <?php if (isset($_POST['ENDS'])) { echo 'checked'; } ?> />
		</div>
		<div>
			<label>Show 2D mol:</label>
			<input type='checkbox' name='SHOW2D' <?php if (isset($_POST['SHOW2D']) || ($_GET['2D'] == 1)) { echo 'checked'; } ?> />
		</div>
		<br/>
	</td></tr>
</table>